<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			var numStr = '1234'
			var isAdmin = true
			// 隐式转换
			// 字符串转换为数字(利用算术运算符(除+运算符))
			var res = numStr * 1

			var res2 = isAdmin + 1
			console.log('res:', res)
			console.log('res2 :>> ', res2)

			// 显示转换
			var res3 = Number(numStr)
			console.log('res3 :>> ', res3)
			console.log(Number(null)) // 0
			console.log(Number(undefined)) // NaN
			console.log(Number(false)) // 0
			console.log(Number('abc123')) // NaN
			console.log(Number('  123  ')) // 除去两端空格
		</script>
	</body>
</html>
